package com.feng.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * Created by Administrator on 2017/3/29.
 */
public class Search {
    private String no;
    private String company;
    private String name;
    private String licensePlate;
    private Long op;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date fromDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date toDate;
    private String orderBy;
    private Integer pageSize;
    private Integer currentPage;

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getOp() {
        return op;
    }

    public void setOp(Long op) {
        this.op = op;
    }

    public String getLicensePlate() {
        return licensePlate;
    }

    public void setLicensePlate(String licensePlate) {
        this.licensePlate = licensePlate;
    }

    public Date getFromDate() {
        return fromDate;
    }

    public void setFromDate(Date fromDate) {
        this.fromDate = fromDate;
    }

    public Date getToDate() {
        return toDate;
    }

    public void setToDate(Date toDate) {
        this.toDate = toDate;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public Integer getCurrentPage() {
        if(currentPage!=null){
            return currentPage;
        }
        return 1;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        if(pageSize!=null){
            return pageSize;
        }
        return 10;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public static void main(String[] args) throws UnsupportedEncodingException {
        //编码
        String strUTF = "上海";
        String encode = URLEncoder.encode(strUTF, "utf-8");
        System.out.println(encode);//%E4%B8%8A%E6%B5%B7

        //解码
        String decoStr = "%E4%B8%8A%E6%B5%B7";
        String decode = URLDecoder.decode(decoStr, "utf-8");
        System.out.println(decode);//上海

        String encodex = URLEncoder.encode("上海", "utf-8");
        System.out.println(encodex);
    }
}
